package pt.isec.gps.fastnote;

/*
 * Note.java Copyright 2011 Emilio Simoes This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version. This library is distributed in the hope that it will be
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU
 * Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. Created on 3 de
 * Dez de 2011 by emilio
 */

/**
 * Represents a single note.
 * 
 * @author Emilio Simoes
 * @version $Revision$
 */
public class Note {

    private String fileName;

    private String content;

    /**
     * Constructor for the note.
     * 
     * @param fileName The location of the note on disk.
     * @param content The content of the note.
     */
    public Note(String fileName, String content) {
        this.fileName = fileName;
        this.content = content;
    }

    /**
     * Gets the fileName of the note on disk.
     * 
     * @return The fileName of the note on disk.
     */
    public String getFileName() {
        return fileName;
    }

    /**
     * Sets the fileName of the note on disk.
     * 
     * @param fileName The fileName of the note on disk to set.
     */
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    /**
     * Gets the content of the note.
     * 
     * @return The content of the note.
     */
    public String getContent() {
        return content;
    }

    /**
     * Sets the content of the note.
     * 
     * @param content The content of the note to set.
     */
    public void setContent(String content) {
        this.content = content;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((content == null) ? 0 : content.hashCode());
        result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
        return result;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Note)) {
            return false;
        }
        Note other = (Note) obj;
        if (content == null) {
            if (other.content != null) {
                return false;
            }
        } else if (!content.equals(other.content)) {
            return false;
        }
        if (fileName == null) {
            if (other.fileName != null) {
                return false;
            }
        } else if (!fileName.equals(other.fileName)) {
            return false;
        }
        return true;
    }
}
